package mymac.com.test_viewpagefragment_1;

import android.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import layout.SecondFragment;
import layout.firstFragment;

public class MainActivity extends AppCompatActivity {

    private ViewPager viewPager;
    private ArrayList<Fragment> fmList;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        viewPager = (ViewPager) findViewById(R.id.viewPager);
        fmList = new ArrayList<Fragment>();
        fmList.add(new firstFragment());
        fmList.add(new SecondFragment());
        viewPager.setAdapter(new MyFmAdapter(getSupportFragmentManager(),this,fmList));
    }
}
